home *** CD-ROM | disk | FTP | other *** search
/ MacAddict 104 / MacAddict_104_2005-04.iso / Software / Internet & Communication / WordPress 1.2.2 freeware.dmg / wordpress / wp-includes / vars.php < prev    next >
Encoding:
PHP Script  |  2004-05-08  |  6.3 KB  |  188 lines

  1. <?php
  2.  
  3. /* This file sets various arrays and variables for use in WordPress */
  4. require(ABSPATH . 'wp-includes/version.php');
  5.  
  6. # Translation of invalid Unicode references range to valid range
  7. $wp_htmltranswinuni = array(
  8.     '€' => '€', // the Euro sign
  9.     '' => '',
  10.     '‚' => '‚', // these are Windows CP1252 specific characters
  11.     'ƒ' => 'ƒ',  // they would look weird on non-Windows browsers
  12.     '„' => '„',
  13.     '…' => '…',
  14.     '†' => '†',
  15.     '‡' => '‡',
  16.     'ˆ' => 'ˆ',
  17.     '‰' => '‰',
  18.     'Š' => 'Š',
  19.     '‹' => '‹',
  20.     'Œ' => 'Œ',
  21.     '' => '',
  22.     'Ž' => 'ž',
  23.     '' => '',
  24.     '' => '',
  25.     '‘' => '‘',
  26.     '’' => '’',
  27.     '“' => '“',
  28.     '”' => '”',
  29.     '•' => '•',
  30.     '–' => '–',
  31.     '—' => '—',
  32.     '˜' => '˜',
  33.     '™' => '™',
  34.     'š' => 'š',
  35.     '›' => '›',
  36.     'œ' => 'œ',
  37.     '' => '',
  38.     'ž' => '',
  39.     'Ÿ' => 'Ÿ'
  40. );
  41.  
  42. // On which page are we ?
  43. $PHP_SELF = $_SERVER['PHP_SELF'];
  44. $pagenow = explode('/', $PHP_SELF);
  45. $pagenow = trim($pagenow[(sizeof($pagenow)-1)]);
  46. $pagenow = explode('?', $pagenow);
  47. $pagenow = $pagenow[0];
  48. if (($querystring_start == '/') && ($pagenow != 'post.php')) {
  49.     $pagenow = get_settings('siteurl') . '/' . get_settings('blogfilename');
  50. }
  51.  
  52. // Simple browser detection
  53. $is_lynx = 0; $is_gecko = 0; $is_winIE = 0; $is_macIE = 0; $is_opera = 0; $is_NS4 = 0;
  54. if (!isset($HTTP_USER_AGENT)) {
  55.     $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
  56. }
  57. if (preg_match('/Lynx/', $HTTP_USER_AGENT)) {
  58.     $is_lynx = 1;
  59. } elseif (preg_match('/Gecko/', $HTTP_USER_AGENT)) {
  60.     $is_gecko = 1;
  61. } elseif ((preg_match('/MSIE/', $HTTP_USER_AGENT)) && (preg_match('/Win/', $HTTP_USER_AGENT))) {
  62.     $is_winIE = 1;
  63. } elseif ((preg_match('/MSIE/', $HTTP_USER_AGENT)) && (preg_match('/Mac/', $HTTP_USER_AGENT))) {
  64.     $is_macIE = 1;
  65. } elseif (preg_match('/Opera/', $HTTP_USER_AGENT)) {
  66.     $is_opera = 1;
  67. } elseif ((preg_match('/Nav/', $HTTP_USER_AGENT) ) || (preg_match('/Mozilla\/4\./', $HTTP_USER_AGENT))) {
  68.     $is_NS4 = 1;
  69. }
  70. $is_IE    = (($is_macIE) || ($is_winIE));
  71.  
  72. // browser-specific javascript corrections
  73. $wp_macIE_correction['in'] = array(
  74.     '/\%uFFD4/', '/\%uFFD5/', '/\%uFFD2/', '/\%uFFD3/',
  75.     '/\%uFFA5/', '/\%uFFD0/', '/\%uFFD1/', '/\%uFFBD/',
  76.     '/\%uFF83%uFFC0/', '/\%uFF83%uFFC1/', '/\%uFF83%uFFC6/', '/\%uFF83%uFFC9/',
  77.     '/\%uFFB9/', '/\%uFF81%uFF8C/', '/\%uFF81%uFF8D/', '/\%uFF81%uFFDA/',
  78.     '/\%uFFDB/'
  79. );
  80. $wp_macIE_correction['out'] = array(
  81.     '‘', '’', '“', '”',
  82.     '•', '–', '—', 'Ω',
  83.     'β', 'γ', 'θ', 'λ',
  84.     'π', '′', '″', '∠',
  85.     '€'
  86. );
  87. $wp_gecko_correction['in'] = array(
  88.     '/\‚Äò/', '/\‚Äô/', '/\‚Äú/', '/\‚Äù/',
  89.     '/\‚Ä¢/', '/\‚Äì/', '/\‚Äî/', '/\Œ©/',
  90.     '/\Œ≤/', '/\Œ≥/', '/\Œ∏/', '/\Œª/',
  91.     '/\œÄ/', '/\‚Ä≤/', '/\‚Ä≥/', '/\‚à/',
  92.     '/\‚Ǩ/', '/\‚Äâ/'
  93. );
  94. $wp_gecko_correction['out'] = array(
  95.     '&8216;', '’', '“', '”',
  96.     '•', '–', '—', 'Ω',
  97.     'β', 'γ', 'θ', 'λ',
  98.     'π', '′', '″', '∠',
  99.     '€', ' '
  100. );
  101.  
  102. // Server detection
  103. $is_apache = strstr($_SERVER['SERVER_SOFTWARE'], 'Apache') ? 1 : 0;
  104. $is_IIS = strstr($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') ? 1 : 0;
  105.  
  106. // if the config file does not provide the smilies array, let's define it here
  107. if (!isset($wpsmiliestrans)) {
  108.     $wpsmiliestrans = array(
  109.         ' :)'        => 'icon_smile.gif',
  110.         ' :D'        => 'icon_biggrin.gif',
  111.         ' :-D'       => 'icon_biggrin.gif',
  112.         ':grin:'    => 'icon_biggrin.gif',
  113.         ' :)'        => 'icon_smile.gif',
  114.         ' :-)'       => 'icon_smile.gif',
  115.         ':smile:'   => 'icon_smile.gif',
  116.         ' :('        => 'icon_sad.gif',
  117.         ' :-('       => 'icon_sad.gif',
  118.         ':sad:'     => 'icon_sad.gif',
  119.         ' :o'        => 'icon_surprised.gif',
  120.         ' :-o'       => 'icon_surprised.gif',
  121.         ':eek:'     => 'icon_surprised.gif',
  122.         ' 8O'        => 'icon_eek.gif',
  123.         ' 8-O'       => 'icon_eek.gif',
  124.         ':shock:'   => 'icon_eek.gif',
  125.         ' :?'        => 'icon_confused.gif',
  126.         ' :-?'       => 'icon_confused.gif',
  127.         ' :???:'     => 'icon_confused.gif',
  128.         ' 8)'        => 'icon_cool.gif',
  129.         ' 8-)'       => 'icon_cool.gif',
  130.         ':cool:'    => 'icon_cool.gif',
  131.         ':lol:'     => 'icon_lol.gif',
  132.         ' :x'        => 'icon_mad.gif',
  133.         ' :-x'       => 'icon_mad.gif',
  134.         ':mad:'     => 'icon_mad.gif',
  135.         ' :P'        => 'icon_razz.gif',
  136.         ' :-P'       => 'icon_razz.gif',
  137.         ':razz:'    => 'icon_razz.gif',
  138.         ':oops:'    => 'icon_redface.gif',
  139.         ':cry:'     => 'icon_cry.gif',
  140.         ':evil:'    => 'icon_evil.gif',
  141.         ':twisted:' => 'icon_twisted.gif',
  142.         ':roll:'    => 'icon_rolleyes.gif',
  143.         ':wink:'    => 'icon_wink.gif',
  144.         ' ;)'        => 'icon_wink.gif',
  145.         ' ;-)'       => 'icon_wink.gif',
  146.         ':!:'       => 'icon_exclaim.gif',
  147.         ':?:'       => 'icon_question.gif',
  148.         ':idea:'    => 'icon_idea.gif',
  149.         ':arrow:'   => 'icon_arrow.gif',
  150.         ' :|'        => 'icon_neutral.gif',
  151.         ' :-|'       => 'icon_neutral.gif',
  152.         ':neutral:' => 'icon_neutral.gif',
  153.         ':mrgreen:' => 'icon_mrgreen.gif',
  154.     );
  155. }
  156.  
  157. // sorts the smilies' array
  158. if (!function_exists('smiliescmp')) {
  159.     function smiliescmp ($a, $b) {
  160.        if (strlen($a) == strlen($b)) {
  161.           return strcmp($a, $b);
  162.        }
  163.        return (strlen($a) > strlen($b)) ? -1 : 1;
  164.     }
  165. }
  166. uksort($wpsmiliestrans, 'smiliescmp');
  167.  
  168. // generates smilies' search & replace arrays
  169. foreach($wpsmiliestrans as $smiley => $img) {
  170.     $wp_smiliessearch[] = $smiley;
  171.     $smiley_masked = str_replace(' ', '', $smiley);
  172.     $wp_smiliesreplace[] = " <img src='" . get_settings('siteurl') . "/wp-images/smilies/$img' alt='$smiley_masked' />";
  173. }
  174.  
  175. // Path for cookies
  176. define('COOKIEPATH', preg_replace('|http://[^/]+|i', '', get_settings('home') . '/' ) );
  177.  
  178. // Some default filters
  179. add_filter('category_description', 'wptexturize');
  180. add_filter('list_cats', 'wptexturize');
  181. add_filter('comment_author', 'wptexturize');
  182. add_filter('comment_text', 'wptexturize');
  183. add_filter('single_post_title', 'wptexturize');
  184. add_filter('the_title', 'wptexturize');
  185. add_filter('the_content', 'wptexturize');
  186. add_filter('the_excerpt', 'wptexturize');
  187. add_action('wp_head', 'doGeoUrlHeader');
  188. ?>